﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Asplode.GameEntity.Characters;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Asplode.GameWorld
{
    public class AsplodeCamera
    {
        public Mode CameraMode { get; set; }

        public enum Mode
        {
            FirstPerson,
            ThirdPerson,
            TopDown
        }

        public Matrix CameraView { get; set; }        

        public GraphicsDevice GraphicsDevice { get; set; }

        public void UpdateFirstPersonMode(Character Player)
        {
            Vector3 CameraPosition = Player.gameObject.body.centerPosition + Vector3.Up;
            Vector3 lookAt = Player.rotationVector + CameraPosition;

            CameraView = Matrix.CreateLookAt(CameraPosition, lookAt, Vector3.Up);
        }

        public void UpdateThirdPersonMode(Character Player)
        {
            Vector3 lookAt = Player.gameObject.body.centerPosition + Vector3.Up + Player.rotationVector * 3;

            Vector3 CameraPosition = -Player.rotationVector * 7 + Player.gameObject.body.centerPosition + Vector3.Up * 5;

            CameraView = Matrix.CreateLookAt(CameraPosition, lookAt, Vector3.Up);
        }

        public void UpdateTopDownMode(Vector3 CameraPosition)
        {
            CameraView = Matrix.CreateLookAt(CameraPosition, Vector3.Zero, Vector3.Up);
        }
    }
}
